#ifndef KANG_SESSION_PROTOCOL_H_
#define KANG_SESSION_PROTOCOL_H_
#pragma once
#include "stdafx.h"
static const std::string FLASH_POLICY_XML = 
	"<cross-domain-policy>\
	<site-control permitted-cross-domain-policies=\"all\"/>\
	<allow-access-from domain=\"*\" to-ports=\"*\" />\
	</cross-domain-policy>\0";
class SessionProtocol{
public:
	SessionProtocol(Socket& socket):_socket(socket){

	}
	void start(){
		async_read(_socket,buffer(_buf),transfer_at_least(1),
			boost::bind(&SessionProtocol::on_read,this,_1,_2));
	}
	void shutdown(){

	}

private:
	void on_read(const ErrorCode& ec,size_t size);
	void on_write(const ErrorCode& ec,size_t size);
	
	void loginSuccess();

	bool AssertError(const ErrorCode& ec){
		if(!ec){
			return true;
		}else{
			shutdown();
			return false;
		}
	}
	Socket& _socket;
	array<char, 512> _buf;
	std::string _request;
};

#endif

